Written by Paul Freeburn and Mark Baumwell, Apple Developer Technical Support (DTS)
Developers need to know the physical addresses of Macintosh system memory because they may have NuBus(TM) boards that access system RAM. If they DMA into system RAM, they often need to allocate large chunks of contiguous memory. Developers are finding that on Power Macintoshes, they can't get as much contiguous memory as on past CPUs.
This white paper discusses the physical layout of Power Macintosh motherboard and expansion DRAM and illustrates that the Power Macintoshes have blocks of physically discontiguous memory. Note that this information applies specifically to the first generation Power Macintosh CPUs: the 6100, 7100, and 8100 series.
To expand the Power Macintosh memory beyond the 8MB that comes on the motherboard requires 72-pin SIMMS installed in identical pairs. This is because the PowerPC architecture has a 64 bit wide data bus whereas 72-pin SIMMS have a 32 bit wide bus. For example, adding 8MB of memory to a Power Macintosh requires two 4MB SIMMS installed as a pair. Power Macintosh 6100, 7100, and 8100 computers have two, four, and eight SIMM sockets, respectively, resulting in one, two, and four SIMM pairs.
A 72-pin SIMM has either one or two banks of DRAM, and each bank is typically constructed with eight devices, usually with 256Kx4, 1Mx4, or 4Mx4 parts. Therefore, with these devices, a compatible 72-pin SIMM will contain either eight or sixteen DRAM devices depending whether it has one or two banks. As an example: eight 4Mx4 DRAM devices are used to make a 16MB single bank SIMM (4M by 32 bits); and sixteen 4Mx4 devices are used to make a 32MB dual bank SIMM (2 banks of 4M by 32 bits each). Similarly, 256Kx4 or 1Mx4 DRAM devices can be used to construct 1MB or 2MB and 4MB or 8MB SIMMS respectively.
Again, the Power Macintoshes can be expanded with single or dual banked SIMMS, provided the SIMMS are installed in identical pairs. Meaning the two SIMMS in any one pair must be identical, but SIMMS can vary from pair to pair, i.e., one pair of single bank 4MB SIMMS, and one pair of dual bank 32MB SIMMS. The Power Macintosh architecture arranges memory in banks where two SIMM slots (one pair) represents two separate banks with each bank allocated a 64MB address space.
Since the Power Macintosh 6100, 7100, and 8100 computers have two, four, and eight SIMM sockets, respectively, they have two, four, and eight memory banks, respectively. Figure 1 shows you what the SIMM layout for the 8100 looks like:
Figure 1. SIMM layout for the Power Macintosh 8100
Let's say there's a pair of single bank SIMMs installed (typically a single bank SIMM has eight DRAM devices mounted on one side of the SIMM). In this example, memory is expanded in bank 1 while bank 2 is empty. Power Macintosh memory banks span 64 bits; the upper 32 bits and lower 32 bits are allocated to the SIMMs in sockets A and B, respectively.
Pictorially, it would look like this, as shown in Figure 2:
Figure 2. Memory allocated to SIMMs in sockets A and B.
Now let's say a pair of dual bank SIMMs are installed (by dual bank, we mean each SIMM has sixteen DRAM devices, eight parts mounted on each side of the SIMM). In this case, memory is expanded in both banks 1 and 2.
Pictorially, it would look like this, as shown in Figure 3:
Figure 3. Memory expanded in both banks 1 and 2.
Even though the Power Macintosh allocates a 64MB address space per bank, it will only physically address 32MB per bank. The first and last 16MB in each bank is not accessible, resulting in physically discontiguous memory from bank to bank. Expansion memory always starts at a 16MB offset within the bank and grows upward in address space, which translates to 32MB of non accessible address space between banks. The one exception to this rule is the 8MB of motherboard memory: motherboard memory is allocated in the first 8MB of bank 1. Since each bank has a 16MB offset, there is no conflict if bank one is also used for expansion.
In tabular form, in Figure 4, here are the physical address starting and ending points for expansion memory:
Figure 4: Physical address starting and ending points for expansion memory.
* The 7100 has four SIMM sockets, pairs 1 and 2, that expand memory in banks 1, 2, 3, and 4, respectively.
* The 8100 has eight SIMM sockets, pairs 1 through 4, that expand memory in banks 1 through 8, respectively.
*a. Note, the 6100 has two SIMM sockets (one pair) that expands memory in banks 1 and 3. The 16MB offset at the start of each bank still applies.
Let's look at a couple of example expansion RAM scenarios (excluding the 6100).
EXAMPLE 1
Two single bank 4MB SIMMS are installed in the first two SIMM sockets (bank 1 and 2). This will expand the Power Macintosh memory by 8MB in bank 1 from 0x01000000 to 0x017FFFFF. The 8MB of motherboard memory is mapped into bank 1 from 0x00000000 to 0x007FFFFF. Note, within bank 1 there is always 8MB of physical memory gap from the end of motherboard memory to the start of expansion memory.
EXAMPLE 2
Two dual bank 32MB SIMMS are installed in the third and fourth sockets (bank 3 and 4). This expands the Power Macintosh memory by 64MB; two separate 32MB blocks from 0x09000000 to 0x0AFFFFFF and 0x0D000000 to 0x0EFFFFFF, banks 3 and 4 respectively. Again, motherboard memory maps into bank 1.
Thus, the maximum possible physically contiguous memory block that can be allocated in a Power Macintosh is 32MB. How much physically contiguous memory that can be allocated depends greatly on how many INITs and applications are loaded, how big the system heap is, how much memory is above BufPtr, etc. In other words, it will depend on the logical layout of the system's memory. Technical Note ME 9, Coping With VM and Memory Mappings, warns of this with the following statement:
Apple can only warn developers that LockMemoryContiguous is potentially an expensive operation in terms of performance and is one very likely to fail since contiguous physical memory may be difficult, if not impossible, to find.
FURTHER REFERENCE
Technical Note ME 9 Coping With VM and Memory Mappings April 1991
Inside Macintosh: Memory
Send questions or problems to devfeedback@applelink.apple.com.